/**
 * @create 2022-04-24
 * @desc 表格区域，增加除表格外其他可放置组件的区域
 */

import cs from 'classnames';
import { ProTableProps } from '../../types';
import { TableComp } from '../table/table';
import styles from './index.module.less';

export const TableContainer = <T,>(props: ProTableProps<T>) => {
  const { table: tableProps, TopBlock, fillPage = true } = props;

  const tableStyleProps = fillPage ? { scroll: { y: 'auto' } } : {};

  return (
    <div className="flex flex-col h-full">
      {TopBlock || null}
      <div className={cs('flex-auto h-0 my-16 bg-white', { [styles.proTable]: fillPage })}>
        <TableComp<T> {...tableStyleProps} {...tableProps} />
      </div>
    </div>
  );
};
